package com.xl.bigdata.spark.sql.example;

import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.exception.ExceptionUtils;

public class Logger {

    public static void debug(Class<?> clazz, String message) {
        log(clazz, "DEBUG", message);
    }

    public static void info(Class<?> clazz, String message) {
        log(clazz, "INFO", message);
    }

    public static void warn(Class<?> clazz, String message) {
        log(clazz, "WARN", message);
    }

    public static void error(Class<?> clazz, String message) {
        error(clazz, message, null);
    }

    public static void error(Class<?> clazz, Throwable th) {
        error(clazz, "", th);
    }

    public static void error(Class<?> clazz, String message, Throwable th) {
        String result = "";
        if (message != null) {
            result = result + message;
        }
        if (th != null) {
            result = result + "\n" + ExceptionUtils.getStackTrace(th);
        }
        if (StringUtils.isNotEmpty(result)) {
            log(clazz, "ERROR", result);
        }
    }

    private static void log(Class<?> clazz, String inputLogLevel, String message) {
        try {

        } catch (Exception e) {
            e.printStackTrace();
        }
    }


}
